/*
*   GameLayer.h
*   ___PROJECTNAME___
*
*   Created by ___FULLUSERNAME___ on ___DATE___.
*   Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
*
*/

#ifndef __GameLayer_h__
#define __GameLayer_h__


// When you import this file, you import all the cocos2d classes
#include "cocos2d.h"


////////////////////////////////////////////////////////
//

class b2World;

namespace ___game_namespace___ {

////////////////////////////////////////////////////////
//
/** GameScene
 * 
*/
////////////////////////////////////////////////////////

class GameScene : public cocos2d::CCScene
{
	GameScene() {;}

public:
	~GameScene();

    // static constructor
    static cocos2d::CCScene* scene();

public:
	//Cocos2d functions
	virtual bool init(); // can't do anything with resiurces in init, because resources of previous scene are not freed
	virtual void onExit(); // load resources
	virtual void onEnter(); // free resources

};

////////////////////////////////////////////////////////
//
/** GameLayer
 *  Listining for touches and accelerometer
*/
////////////////////////////////////////////////////////

class GameLayer : public cocos2d::CCLayer 
{
	b2World* _world;
	
private:
	GameLayer();

public:
    ~GameLayer();
    
    // static constructor
	// Phisical layer need size on initialisation, because it draw physical world on this size
    static cocos2d::CCNode* node(const cocos2d::CCSize& contentSize);
    
public:
	//Cocos2d functions
	// Phisical layer need size on initialisation, because it draw physical world on this size
	virtual bool init(const cocos2d::CCSize& contentSize);

	//tick
	void tick(cocos2d::ccTime dt);

	//Listining for touch events
    virtual void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
    
	//Listining for accelerometer events
    void didAccelerate(cocos2d::CCAcceleration* pAccelerationValue );
    
private:
    // close game scene (menu item callback)
	void onClose(CCObject* caller);

    // adds a new sprite at a given coordinate
    void addNewSpriteWithCoords(cocos2d::CCPoint p);

}; // class GameLayer

} // namespace ___game_namespace___

#endif // __GameLayer_h__
